//
//  VideoTableViewCell.m
//  MeiShiDa
//
//  Created by duanshiyi on 15/7/4.
//  Copyright (c) 2015年 zby. All rights reserved.
//
#define SCREEN_WIDTH    [[UIScreen mainScreen] bounds].size.width
#define SCREEN_HEIGHT   [[UIScreen mainScreen] bounds].size.height
#import "VideoTableViewCell.h"
@implementation VideoTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *image1=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg_eventlistcell"]];
        image1.frame=CGRectMake(0, 0, SCREEN_WIDTH, 100);
        [self addSubview:image1];
        
        
        
        self.label=[[UILabel alloc]initWithFrame:CGRectMake(120, 10, SCREEN_WIDTH-120-10, 60)];

        _label.font=[UIFont systemFontOfSize:20];
        _label.numberOfLines=0;
        [self addSubview:_label];
        
        self.label1=[[UILabel alloc]initWithFrame:CGRectMake(120, 70, SCREEN_WIDTH-120-10, 20)];
        
        _label1.font=[UIFont systemFontOfSize:13];
        _label1.textColor=[UIColor grayColor];
        [self addSubview:_label1];
        
        self.image=[[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 100, 80)];
        [self addSubview:_image];
        
        
        UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
//        button.alpha=0.5;
        button.frame=CGRectMake(40, 30, 50, 50);
        [button setImage:[UIImage imageNamed:@"iconfont-bofang"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(play) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
        
        
        
    }
    return self;
}
-(void)play{
    
    [_delegate videoCell:self];
    
}

-(void)setVideo:(VideoModel *)video{
    if (_video!=video) {
         _video=video;
    }
    [ _image sd_setImageWithURL:[NSURL URLWithString:video.image] placeholderImage:[UIImage imageNamed:@"85f857ff02b5f7bc23202e6b13916d7b.jpg"]];
    _label.text=video.title;
    _label1.text=video.date;
    
}



@end
